﻿// src/crudOption/service/serviceList.js
export default () => {
  // ===== 搜索 =====
  const searchOption = ref({
    formConfig: {
      tenantName: { label: "客户名称", component: "el-input" },
      tenantId: { label: "客户ID", component: "el-input" },
      status: {
        label: "开通状态",
        component: "el-select",
        defaultValue: "",
        dicData: [
          { label: "全部", value: "" },
          { label: "已开通", value: 1 },
          { label: "已关闭", value: 2 },
        ],
        dicProps: { label: "label", value: "value" },
        placeholder: "全部",
        clearable: true,
      },
    },
  });

  // ===== 表格/表单 =====
  const tableOption = ref(
    Utils.tools.deleteSearchConfig({
      addTitle: "",
      editTitle: "",
      dialogWidth: 600, // 20% 在窄屏可能太小，这里给个像素更稳；按需改回

      // 是否显示编辑按钮
      editBtn: false,
      // 是否显示删除按钮
      delBtn: false,

      menuWidth: 80,
      // 对齐方式
      align: "left",
      // 表格配置
      /**
       * 弹窗表单（与原型一致）
       */
      group: [
        {
          column: {
            // 1) 客户名称
            tenantId: {
              label: "选择客户",
              span: 24,
              rules: [{ required: true, message: "请选择客户", trigger: "blur" }],
            },
            // 2) 签名）
            smsSign: {
              label: "签名",
              span: 24,
              placeholder: "请输入签名",
              type: "input",
              clearable: true,
              rules: [{ required: true, message: "请输入签名", trigger: "blur" }],
            },
          },
        },
      ],

      /**
       * 列表列
       */
      column: {
        // 客户名称
        tenantName: { label: "客户名称", minWidth: 160, display: false },
        // 客户ID
        tenantId: { label: "客户ID", width: 120, display: false },
        // 资费
        tenantFee: {
          label: "资费",
          minWidth: 100,
          display: false,
        },
        // 使用次数
        useCount: {
          label: "使用次数",
          minWidth: 100,
          display: false,
        },
        createTime: {
          label: "开通时间",
          minWidth: 170,
          type: "datetime",
          valueFormat: "YYYY-MM-DD HH:mm:ss",
          addDisplay: false,
          editDisplay: false,
        },

        updateTime: {
          label: "最近编辑时间",
          minWidth: 170,
          type: "datetime",
          valueFormat: "YYYY-MM-DD HH:mm:ss",
          addDisplay: false,
          editDisplay: false,
        },

        updateName: {
          label: "最近操作人员",
          minWidth: 120,
          addDisplay: false,
          editDisplay: false,
        },

        status: {
          label: "开通状态",
          width: 120,
          dicData: [
            { label: "关闭", value: 2 },
            { label: "开通", value: 1 },
          ],
          display: false, // 列表里你用自定义 slot + 开关，所以这里不渲染内置
        },
      },
    })
  );

  return { searchOption, tableOption };
};
